package com.briup.cms.dao;

import com.briup.cms.bean.Article;
import com.briup.cms.exception.CustomerException;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface ArticleMapper {
    // 通过id查询咨询信息，同时获取咨询对应的栏目和用户信息
    Article findByIdWithCategoryAndUser(int id)throws CustomerException;

    List<Article> findByIdWithCategory(int categoryId)throws CustomerException;

    // 保存或更新咨询信息
    void saveOrUpdate(Article article) throws CustomerException;

    void save(Article article) throws CustomerException;

    void update(Article article) throws CustomerException;

    void updateCategoryId(Article article) throws CustomerException;

    // 分页查询咨询信息，同时获取咨询对应的栏目和用户信息
    List<Article> pageQueryArticleWithCategoryAndUser(String title, Integer status, Integer categoryId)throws CustomerException;

    // 通过id删除咨询信息
    void deleteById(int id) throws CustomerException;

    // 分页查询推荐被推荐的咨询信息，同时获取咨询对应的栏目和用户信息
    List<Article> pageQueryRecommend(int pageNum, int pageSize)throws CustomerException;

    // 修改咨询信息的状态，状态：0-待审核，1-不通过，2-通过，3-推荐
    void changeStatus(int id,int status) throws CustomerException;
}
